﻿	      <?php include("conn.php");
             mysql_query('SET NAMES UTF8'); 
error_reporting(0);
	  

class MyPrizeBean
{
	
	public $heading;
	public $name;
    public $srcimg;
	public $images;
	public $title;
	public $addtime;
	public $reply;
	public $content;
	public $like;
	public $cid;
	
	function __construct($heading,$name,$srcimg,$images,$title,$addtime,$reply,$content,$like,$cid)
	{
		$this->heading      = $heading;
		$this->name      = $name;
        $this->srcimg      = $srcimg;
		$this->images      = $images;
		$this->title      = $title;
		$this->addtime      = $addtime;
		$this->reply      = $reply;
		$this->content      = $content;
		$this->like      = $like;
		$this->cid      = $cid;
	
	}
}


$upfile = 'uploads/';
if (!file_exists($upfile)) { 
        mkdir($upfile, 0777, true);
 }


$rert31 = mysql_query("select * from talks where  id ='".$_REQUEST['talkid']."'");
$prize = array();
$rowf = mysql_fetch_array($rert31);
 
$de = array();//图片
if($rowf[images]!="") {
	$ime = $rowf[images];
    $de = explode("," ,$ime);
}
				 //图片end

$pic_quantity = count($de);
$smallImg = array();

if($rowf[thumbImages]!="") {
      $ime = $rowf[thumbImages];
      $smallImg = explode("," ,$ime);
}

switch ($rowf['role']) {
	case 1:
		$table = 'user';
		$id = 'userid';
		$rert32 = mysql_query("select * from " . $table . " where " . $id . " = '" . $rowf[userid]."'");
		$rowf3 = mysql_fetch_array($rert32);
		break;
	
	case 2:
		$table = 'shop';
		$id = 'shopid';
		$rert32 = mysql_query("select * from " . $table . " where " . $id . " = '" . $rowf[userid]."'");
		$rowf3 = mysql_fetch_array($rert32);
		break;
}

if($rowf3['name']) {
	$rowf3['niname'] = $rowf3['name'];
}

/*$rert32=mysql_query("select * from user where userid='" . $rowf[userid]."'");
$rowf3=mysql_fetch_array($rert32);*/
   
$prize[] = new MyPrizeBean($rowf3['images'],$rowf3['niname'],$de,$smallImg,$rowf['title'],$rowf['addtime'],$rowf['replymember'],$rowf['content'],$rowf['xihuan'],$rowf['id']);

echo json_encode($prize);


?>